.class final Lcom/greystripe/sdk/bh;
.super Ljava/lang/Object;


# static fields
.field private static b:Lcom/greystripe/sdk/bh;


# instance fields
.field private a:Landroid/content/Context;


# direct methods
.method private constructor <init>()V
    .locals 0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method private constructor <init>(Landroid/content/Context;)V
    .locals 0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object p1, p0, Lcom/greystripe/sdk/bh;->a:Landroid/content/Context;

    return-void
.end method

.method public static declared-synchronized a(Landroid/content/Context;)Lcom/greystripe/sdk/bh;
    .locals 2

    const-class v1, Lcom/greystripe/sdk/bh;

    monitor-enter v1

    :try_start_0
    sget-object v0, Lcom/greystripe/sdk/bh;->b:Lcom/greystripe/sdk/bh;

    if-nez v0, :cond_0

    new-instance v0, Lcom/greystripe/sdk/bh;

    invoke-direct {v0, p0}, Lcom/greystripe/sdk/bh;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcom/greystripe/sdk/bh;->b:Lcom/greystripe/sdk/bh;

    :cond_0
    sget-object v0, Lcom/greystripe/sdk/bh;->b:Lcom/greystripe/sdk/bh;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v1

    return-object v0

    :catchall_0
    move-exception v0

    monitor-exit v1

    throw v0
.end method

.method private c()Lcom/greystripe/sdk/bi;
    .locals 2

    iget-object v0, p0, Lcom/greystripe/sdk/bh;->a:Landroid/content/Context;

    const-string v1, "connectivity"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/ConnectivityManager;

    invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-virtual {v0}, Landroid/net/NetworkInfo;->isConnected()Z

    move-result v1

    if-nez v1, :cond_1

    :cond_0
    sget-object v0, Lcom/greystripe/sdk/bi;->OFFLINE:Lcom/greystripe/sdk/bi;

    :goto_0
    return-object v0

    :cond_1
    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getType()I

    move-result v0

    if-nez v0, :cond_2

    sget-object v0, Lcom/greystripe/sdk/bi;->CELLULAR:Lcom/greystripe/sdk/bi;

    goto :goto_0

    :cond_2
    sget-object v0, Lcom/greystripe/sdk/bi;->WIFI:Lcom/greystripe/sdk/bi;

    goto :goto_0
.end method


# virtual methods
.method public final a()Z
    .locals 2
    .annotation runtime Landroid/webkit/JavascriptInterface;
    .end annotation

    invoke-direct {p0}, Lcom/greystripe/sdk/bh;->c()Lcom/greystripe/sdk/bi;

    move-result-object v0

    sget-object v1, Lcom/greystripe/sdk/bi;->OFFLINE:Lcom/greystripe/sdk/bi;

    if-eq v0, v1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public final b()Z
    .locals 2
    .annotation runtime Landroid/webkit/JavascriptInterface;
    .end annotation

    invoke-direct {p0}, Lcom/greystripe/sdk/bh;->c()Lcom/greystripe/sdk/bi;

    move-result-object v0

    sget-object v1, Lcom/greystripe/sdk/bi;->WIFI:Lcom/greystripe/sdk/bi;

    if-ne v0, v1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method
